<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>C MIP-SDK: ring_buffer.h File Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">C MIP-SDK
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Defines</a> &#124;
<a href="#typedef-members">Typedefs</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">ring_buffer.h File Reference</div>  </div>
</div>
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="mip__types_8h_source.html">mip_types.h</a>&quot;</code><br/>
<code>#include &lt;string.h&gt;</code><br/>
<code>#include &lt;stdlib.h&gt;</code><br/>
</div>
<p><a href="ring__buffer_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct__ring__buffer.html">_ring_buffer</a></td></tr>
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad1241f040d022507b8be8305e4fbc895"></a><!-- doxytag: member="ring_buffer.h::RING_BUFFER_UNINITIALIZED" ref="ad1241f040d022507b8be8305e4fbc895" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RING_BUFFER_UNINITIALIZED</b>&#160;&#160;&#160;0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aefabb4332dd1bf0fec897b795c051705"></a><!-- doxytag: member="ring_buffer.h::RING_BUFFER_INITIALIZED" ref="aefabb4332dd1bf0fec897b795c051705" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RING_BUFFER_INITIALIZED</b>&#160;&#160;&#160;1</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad062127a665826297072d899711e5296"></a><!-- doxytag: member="ring_buffer.h::RING_BUFFER_OK" ref="ad062127a665826297072d899711e5296" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RING_BUFFER_OK</b>&#160;&#160;&#160;0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a84f94deeafb9acfade6bb05c145b53fc"></a><!-- doxytag: member="ring_buffer.h::RING_BUFFER_ERROR" ref="a84f94deeafb9acfade6bb05c145b53fc" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RING_BUFFER_ERROR</b>&#160;&#160;&#160;1</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac071277053b198e8b092cdf09f937f43"></a><!-- doxytag: member="ring_buffer.h::RING_BUFFER_MEMORY_ERROR" ref="ac071277053b198e8b092cdf09f937f43" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RING_BUFFER_MEMORY_ERROR</b>&#160;&#160;&#160;2</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a65d6864a8e9cf09d342d8375880116aa"></a><!-- doxytag: member="ring_buffer.h::RING_BUFFER_SIZE_MISMATCH" ref="a65d6864a8e9cf09d342d8375880116aa" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RING_BUFFER_SIZE_MISMATCH</b>&#160;&#160;&#160;3</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9932947eac3bd1ebe09e88036d914852"></a><!-- doxytag: member="ring_buffer.h::RING_BUFFER_EMPTY" ref="a9932947eac3bd1ebe09e88036d914852" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RING_BUFFER_EMPTY</b>&#160;&#160;&#160;4</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae52b44746ac8388bb6071cfc528fe8d4"></a><!-- doxytag: member="ring_buffer.h::RING_BUFFER_FULL" ref="ae52b44746ac8388bb6071cfc528fe8d4" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RING_BUFFER_FULL</b>&#160;&#160;&#160;5</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a45c2364d4cee8d1788124c15510d7484"></a><!-- doxytag: member="ring_buffer.h::RING_BUFFER_STATIC_TYPE" ref="a45c2364d4cee8d1788124c15510d7484" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RING_BUFFER_STATIC_TYPE</b>&#160;&#160;&#160;0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a07be5a0d205dfad3cc4d2e734a9969c6"></a><!-- doxytag: member="ring_buffer.h::RING_BUFFER_MALLOC_TYPE" ref="a07be5a0d205dfad3cc4d2e734a9969c6" args="" -->
#define&#160;</td><td class="memItemRight" valign="bottom"><b>RING_BUFFER_MALLOC_TYPE</b>&#160;&#160;&#160;1</td></tr>
<tr><td colspan="2"><h2><a name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af9cd8f573319d20f0b2279c32f8250e0"></a><!-- doxytag: member="ring_buffer.h::ring_buffer" ref="af9cd8f573319d20f0b2279c32f8250e0" args="" -->
typedef struct <a class="el" href="struct__ring__buffer.html">_ring_buffer</a>&#160;</td><td class="memItemRight" valign="bottom"><b>ring_buffer</b></td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#a00e0e84737691f9956f36080ccfa2df5">ring_buffer_init_static</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer, u8 *data_buffer_ptr, u32 max_entries, u32 entry_size)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#aaaa7983a42259ec3493bdc6da95e3271">ring_buffer_init_malloc</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer, u32 max_entries, u32 entry_size)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#a62de05750671678f480ef82d2bffd0c6">ring_buffer_count</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#a164aeb3b004644c009c36c5e9b37d429">ring_buffer_remaining_entries</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#a06915ba5348d7cbe361c0bf91bbf7f83">ring_buffer_flush</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#aa9ed8b133ea377b573c3bcbc1127cc0e">ring_buffer_write</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer, u8 *entry, u32 num_bytes)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#aa3b83c01c65e07ac8f4e382d186cb8e9">ring_buffer_write_multi</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer, u8 *entry_buff, u32 num_entries, u32 *num_written)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#a2a784b9ebbd7849d654c0866e23b1f97">ring_buffer_read</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer, u8 *entry, u32 max_bytes)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#a78adbb9324120824e4f75342de380af5">ring_buffer_read_multi</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer, u8 *entry_buff, u32 entry_buff_size, u32 num_requested, u32 *num_read)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#aee8d66bd666f01d63ae5849310abe028">ring_buffer_lookahead_read</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer, u32 offset, u8 *entry, u32 max_bytes)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#a90220a5df5993d1f0ac42c06f18915cb">ring_buffer_lookahead_read_multi</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer, u32 offset, u8 *entry_buff, u32 entry_buff_size, u32 num_requested, u32 *num_read)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#a5a945b91fc139a119cb5b905bf6a9182">ring_buffer_copy</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *to, <a class="el" href="struct__ring__buffer.html">ring_buffer</a> *from, u32 num_entries)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#ac7560884e3e86419dd3e5dde1bd91827">ring_buffer_lookahead_copy</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *to, u32 offset, <a class="el" href="struct__ring__buffer.html">ring_buffer</a> *from, u32 num_entries)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#a35acc1e6935693533294bf4be7b8e30c">ring_buffer_consume_entries</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer, u32 num_entries)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u8 *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#ae4a8700d5d233011f02bf2eb108f3feb">ring_buffer_get_first_element_ptr</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#a2aec6501ce2528ff75aa9505e9218f7c">ring_buffer_remove_first_element</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u8 *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#af6e1b39fe5f3c6099280ea7c92ae8432">ring_buffer_get_available_element_ptr</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#a69bb8f0b107955c2c853a5725bdb47b5">ring_buffer_increment_count</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#a7151050a066e68ad75008b596b4cd6bf">ring_buffer_malloc_free</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="ring__buffer_8h.html#aecc675caf52402d74ffeb7aaaade795d">__ring_buffer_reset</a> (<a class="el" href="struct__ring__buffer.html">ring_buffer</a> *buffer)</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><dl class="author"><dt><b>Author:</b></dt><dd>Nathan Miller </dd></dl>
<dl class="version"><dt><b>Version:</b></dt><dd>1.1 </dd></dl>
</div><hr/><h2>Function Documentation</h2>
<a class="anchor" id="aecc675caf52402d74ffeb7aaaade795d"></a><!-- doxytag: member="ring_buffer.h::__ring_buffer_reset" ref="aecc675caf52402d74ffeb7aaaade795d" args="(ring_buffer *buffer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void __ring_buffer_reset </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Reset the ring buffer state, stats, and buffer. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>Internal Function. </p>

</div>
</div>
<a class="anchor" id="a35acc1e6935693533294bf4be7b8e30c"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_consume_entries" ref="a35acc1e6935693533294bf4be7b8e30c" args="(ring_buffer *buffer, u32 num_entries)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_consume_entries </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>num_entries</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Removes <code>num_entries</code> from the buffer if they exist. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">num_entries</td><td>- the number of entries to remove. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Number of entries removed </dd></dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None. </p>

</div>
</div>
<a class="anchor" id="a5a945b91fc139a119cb5b905bf6a9182"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_copy" ref="a5a945b91fc139a119cb5b905bf6a9182" args="(ring_buffer *to, ring_buffer *from, u32 num_entries)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 ring_buffer_copy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>to</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>from</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>num_entries</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Copy <code>num_entries</code> between two ring buffers. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">ring_buffer</td><td>*to - pointer to a ring buffer structure to copy to. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*from - pointer to a ring buffer structure to copy from. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">num_entries</td><td>- the number of entries to copy. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Number of entries copied </dd></dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None. </p>

</div>
</div>
<a class="anchor" id="a62de05750671678f480ef82d2bffd0c6"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_count" ref="a62de05750671678f480ef82d2bffd0c6" args="(ring_buffer *buffer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 ring_buffer_count </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Returns the number of entries in the ring buffer. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Number of entries in the buffer, if initialized.<br/>
 0 Otherwise. </dd></dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None </p>

</div>
</div>
<a class="anchor" id="a06915ba5348d7cbe361c0bf91bbf7f83"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_flush" ref="a06915ba5348d7cbe361c0bf91bbf7f83" args="(ring_buffer *buffer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_flush </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Flushes the ring buffer. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">RING_BUFFER_ERROR</td><td>Buffer not initialized.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_OK</td><td>Buffer flushed.<br/>
 </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None </p>

</div>
</div>
<a class="anchor" id="af6e1b39fe5f3c6099280ea7c92ae8432"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_get_available_element_ptr" ref="af6e1b39fe5f3c6099280ea7c92ae8432" args="(ring_buffer *buffer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u8* ring_buffer_get_available_element_ptr </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Return a pointer to the next available element in the ring buffer. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>NULL (0) If the ring buffer pointer is invalid or there are no elements.<br/>
 Otherwise, the pointer to first available element. </dd></dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>This routine should only be used for single-element access!!!<br/>
 Attempting to access multiple elements using this can cause access<br/>
 outside of the array boundaries! </p>

</div>
</div>
<a class="anchor" id="ae4a8700d5d233011f02bf2eb108f3feb"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_get_first_element_ptr" ref="ae4a8700d5d233011f02bf2eb108f3feb" args="(ring_buffer *buffer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u8* ring_buffer_get_first_element_ptr </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Return a pointer to the first element in the ring buffer. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>NULL (0) If the ring buffer pointer is invalid or there are no elements.<br/>
 Otherwise, the pointer to first element. </dd></dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>This routine should only be used for single-element access!!!<br/>
 Attempting to access multiple elements using this can cause access<br/>
 outside of the array boundaries! </p>

</div>
</div>
<a class="anchor" id="a69bb8f0b107955c2c853a5725bdb47b5"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_increment_count" ref="a69bb8f0b107955c2c853a5725bdb47b5" args="(ring_buffer *buffer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_increment_count </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Increments the number of elements in the ring buffer. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">RING_BUFFER_ERROR</td><td>Ring buffer invalid.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_EMPTY</td><td>Ring buffer full.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_OK</td><td>Element added.<br/>
 </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>Used in conjunction with ring_buffer_get_available_element_ptr<br/>
 for pointer write access to ring buffer elements. </p>

</div>
</div>
<a class="anchor" id="aaaa7983a42259ec3493bdc6da95e3271"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_init_malloc" ref="aaaa7983a42259ec3493bdc6da95e3271" args="(ring_buffer *buffer, u32 max_entries, u32 entry_size)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_init_malloc </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>max_entries</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>entry_size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Initialize a ring buffer using malloc to allocate the buffer from the heap. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>max_entries - maximum entries the ring buffer may contain. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>entry_size - size of each entry (bytes). </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">RING_BUFFER_ERROR</td><td>Buffer not initialized.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_OK</td><td>Buffer initialized.<br/>
 </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None </p>

</div>
</div>
<a class="anchor" id="a00e0e84737691f9956f36080ccfa2df5"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_init_static" ref="a00e0e84737691f9956f36080ccfa2df5" args="(ring_buffer *buffer, u8 *data_buffer_ptr, u32 max_entries, u32 entry_size)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_init_static </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>data_buffer_ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>max_entries</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>entry_size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Initialize a ring buffer with a static memory location. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u8</td><td>*data_buffer_ptr - data pointer (must be allocated and size = <code>max_entries</code> * <code>entry_size</code>). </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>max_entries - maximum entries the ring buffer may contain. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>entry_size - size of each entry (bytes). </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">RING_BUFFER_ERROR</td><td>Buffer not initialized.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_OK</td><td>Buffer initialized.<br/>
 </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None </p>

</div>
</div>
<a class="anchor" id="ac7560884e3e86419dd3e5dde1bd91827"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_lookahead_copy" ref="ac7560884e3e86419dd3e5dde1bd91827" args="(ring_buffer *to, u32 offset, ring_buffer *from, u32 num_entries)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 ring_buffer_lookahead_copy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>to</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>from</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>num_entries</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Copy <code>num_entries</code> between two ring buffers without consuming the entries. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">ring_buffer</td><td>*to - pointer to a ring buffer structure to copy to. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>offset - offset from the first element to start the copy. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*from - pointer to a ring buffer structure to copy from. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">num_entries</td><td>- the number of entries to copy. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Number of entries copied </dd></dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None. </p>

</div>
</div>
<a class="anchor" id="aee8d66bd666f01d63ae5849310abe028"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_lookahead_read" ref="aee8d66bd666f01d63ae5849310abe028" args="(ring_buffer *buffer, u32 offset, u8 *entry, u32 max_bytes)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_lookahead_read </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>entry</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>max_bytes</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Read an entry from the ring buffer without consuming it. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>offset - offset from the head of the ring buffer to read. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">u8</td><td>*entry - pointer to data buffer where the entry will be stored. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>max_bytes - maximum size of the data buffer. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">RING_BUFFER_ERROR</td><td>Entry not read, buffer not initialized.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_FULL</td><td>Entry not read, the buffer is empty.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_MEMORY_ERROR</td><td>Entry not read, max_bytes is smaller than the ring buffer entry size.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_OK</td><td>Entries read.<br/>
 </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None. </p>

</div>
</div>
<a class="anchor" id="a90220a5df5993d1f0ac42c06f18915cb"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_lookahead_read_multi" ref="a90220a5df5993d1f0ac42c06f18915cb" args="(ring_buffer *buffer, u32 offset, u8 *entry_buff, u32 entry_buff_size, u32 num_requested, u32 *num_read)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_lookahead_read_multi </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>offset</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>entry_buff</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>entry_buff_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>num_requested</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32 *&#160;</td>
          <td class="paramname"><em>num_read</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Read <code>num_requested</code> entries from the ring buffer without consuming them. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>offset - offset from the head of the ring buffer to read. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">u8</td><td>*entry_buff - pointer to data buffer where the entries will be stored. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>entry_buff_size - maximum size of the data buffer in bytes. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>num_requested - the number of entries requested. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">u32</td><td>num_read - the number of entries actually read. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">RING_BUFFER_ERROR</td><td>Entry not read, buffer not initialized.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_EMPTY</td><td>Entry not read, the buffer is empty.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_MEMORY_ERROR</td><td>Entry not read, max_bytes is smaller than the ring buffer entry size.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_OK</td><td>Entries read.<br/>
 </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None. </p>

</div>
</div>
<a class="anchor" id="a7151050a066e68ad75008b596b4cd6bf"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_malloc_free" ref="a7151050a066e68ad75008b596b4cd6bf" args="(ring_buffer *buffer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_malloc_free </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Return the allocated memory to the heap. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">RING_BUFFER_ERROR</td><td>Buffer not initialized or not malloc'd.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_OK</td><td>Buffer freed.<br/>
 </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None. </p>

</div>
</div>
<a class="anchor" id="a2a784b9ebbd7849d654c0866e23b1f97"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_read" ref="a2a784b9ebbd7849d654c0866e23b1f97" args="(ring_buffer *buffer, u8 *entry, u32 max_bytes)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_read </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>entry</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>max_bytes</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Read a single entry from the ring buffer. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">u8</td><td>*entry - pointer to data buffer where the entry will be stored. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>max_bytes - maximum size of the data buffer. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">RING_BUFFER_ERROR</td><td>Entry not read, buffer not initialized.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_FULL</td><td>Entry not read, the buffer is empty.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_MEMORY_ERROR</td><td>Entry not read, max_bytes is smaller than the ring buffer entry size.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_OK</td><td>Entry read.<br/>
 </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None. </p>

</div>
</div>
<a class="anchor" id="a78adbb9324120824e4f75342de380af5"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_read_multi" ref="a78adbb9324120824e4f75342de380af5" args="(ring_buffer *buffer, u8 *entry_buff, u32 entry_buff_size, u32 num_requested, u32 *num_read)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_read_multi </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>entry_buff</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>entry_buff_size</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>num_requested</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32 *&#160;</td>
          <td class="paramname"><em>num_read</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Read <code>num_requested</code> entries from the ring buffer. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">u8</td><td>*entry - pointer to data buffer where the entries will be stored. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>entry_buff_size - maximum size of the data buffer in bytes. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>num_requested - the number of entries requested. </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">u32</td><td>num_read - the number of entries actually read. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">RING_BUFFER_ERROR</td><td>Entry not read, buffer not initialized.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_EMPTY</td><td>Entry not read, the buffer is empty.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_MEMORY_ERROR</td><td>Entry not read, max_bytes is smaller than the ring buffer entry size.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_OK</td><td>Entries read.<br/>
 </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None. </p>

</div>
</div>
<a class="anchor" id="a164aeb3b004644c009c36c5e9b37d429"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_remaining_entries" ref="a164aeb3b004644c009c36c5e9b37d429" args="(ring_buffer *buffer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 ring_buffer_remaining_entries </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Returns the number of empty entries in the ring buffer. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Number of empty entries in the buffer, if initialized.<br/>
 0 Otherwise. </dd></dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>None </p>

</div>
</div>
<a class="anchor" id="a2aec6501ce2528ff75aa9505e9218f7c"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_remove_first_element" ref="a2aec6501ce2528ff75aa9505e9218f7c" args="(ring_buffer *buffer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_remove_first_element </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Removes the first element of the ring buffer if it exists. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">RING_BUFFER_ERROR</td><td>Ring buffer invalid.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_EMPTY</td><td>Ring buffer empty.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_OK</td><td>Element removed.<br/>
 </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>Used in conjunction with ring_buffer_get_first_element_ptr<br/>
 for pointer read access to ring buffer elements. </p>

</div>
</div>
<a class="anchor" id="aa9ed8b133ea377b573c3bcbc1127cc0e"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_write" ref="aa9ed8b133ea377b573c3bcbc1127cc0e" args="(ring_buffer *buffer, u8 *entry, u32 num_bytes)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_write </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>entry</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>num_bytes</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Write <code>num_bytes</code> of a single entry to the ring buffer. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u8</td><td>*entry - pointer to memory buffer holding the entry. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>num_bytes - number of bytes to write. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">RING_BUFFER_ERROR</td><td>Entry not written, buffer not initialized.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_FULL</td><td>Entry not written, the buffer is full.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_MEMORY_ERROR</td><td>Entry not written, num_bytes is larger than the ring buffer entry size.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_OK</td><td>Entry written.<br/>
 </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p><code>num_bytes</code> included for ring buffers with variable entry sizes (e.g. strings). <code>num_bytes</code> must be less than the max entry size. </p>

</div>
</div>
<a class="anchor" id="aa3b83c01c65e07ac8f4e382d186cb8e9"></a><!-- doxytag: member="ring_buffer.h::ring_buffer_write_multi" ref="aa3b83c01c65e07ac8f4e382d186cb8e9" args="(ring_buffer *buffer, u8 *entry_buff, u32 num_entries, u32 *num_written)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u16 ring_buffer_write_multi </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct__ring__buffer.html">ring_buffer</a> *&#160;</td>
          <td class="paramname"><em>buffer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>entry_buff</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>num_entries</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u32 *&#160;</td>
          <td class="paramname"><em>num_written</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<h2><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h2>
<p>Write <code>num_entries</code> to the ring buffer. </p>
<h2><a class="anchor" id="DETAILS"></a>
DETAILS</h2>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">ring_buffer</td><td>*buffer - pointer to a ring buffer structure. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u8</td><td>*entry_buff - pointer to memory buffer holding the entries. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">u32</td><td>num_entries - number of entries to write. </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">RING_BUFFER_ERROR</td><td>Entries not written, buffer not initialized.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_FULL</td><td>Entries not written, the buffer is full.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_MEMORY_ERROR</td><td>Entries not written, num_bytes is larger than the ring buffer entry size.<br/>
 </td></tr>
    <tr><td class="paramname">RING_BUFFER_OK</td><td>Entries written.<br/>
 </td></tr>
  </table>
  </dd>
</dl>
<h2><a class="anchor" id="NOTES"></a>
NOTES</h2>
<p>All entries are assumed to be of size <code>entry_size</code>, which is set by the ring_buffer_init_xxxxxx call. </p>

</div>
</div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Fri May 30 2014 17:03:33 for C MIP-SDK by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
